package game;


import game.controller.*;
import game.model.Board;


import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;


public class Game {
    private Queue<Object> infomation;

    public Game(int w, int h, CreateRule createRule, MoveRule moveRule, MergeRule mergeRule) {
        this.infomation = new LinkedList<>();
        this.infomation.add(w);
        this.infomation.add(h);
        this.infomation.add(createRule);
        this.infomation.add(moveRule);
        this.infomation.add(mergeRule);
    }

    public void startLoop()   {
        int w = (int) this.infomation.poll();
        int h = (int) this.infomation.poll();
        CreateRule createRule = (CreateRule) this.infomation.poll();
        MoveRule moveRule = (MoveRule) this.infomation.poll();
        MergeRule mergeRule = (MergeRule) this.infomation.poll();
        Controller controller = new Controller(new Board(w, h), createRule, moveRule, mergeRule);
        controller.init();
//        try {
//            this.wait();
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
    }
}
